#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

int checkEmbargo(int p, struct gameState *state) {

	int i, r, handCount, coinCount, totalEmbargoTokens, newTotalEmbargoTokens;
	
	handCount = state->handCount[p];
	for (i = 0; i < 17; i++) {
		totalEmbargoTokens = totalEmbargoTokens + state->embargoTokens[p]; 
	}

	r = zzzEmbargoCardPlay(p, state, 0);
	assert(r == 0);

	assert(state->handCount[p] + 1 == handCount);

	newTotalEmbargoTokens = 0;

	for (i = 0; i < 17; i++) {
		newTotalEmbargoTokens = newTotalEmbargoTokens + state->embargoTokens[p];
	}
	assert(totalEmbargoTokens + 1 == newTotalEmbargoTokens);

}

int main() {

	int r, p, handCount;
	int k[10] = {adventurer, council_room, embargo, gardens, mine, remodel, smithy, village, baron, great_hall};

	struct gameState G;

	for (p = 0; p < 2; p++) {
		for (handCount = 0; handCount < 10; handCount++) {	
			memset(&G, 23, sizeof(struct gameState));
			r = initializeGame(2, k, 1, &G);
			G.handCount[p] = handCount;
			memset(G.hand[p], 0, sizeof(int) * handCount);
			checkEmbargo(p, &G);
		}
	}
}
